package com.kgc.community.service.impl;

import com.kgc.community.mapper.MenuMapper;
import com.kgc.community.mapper.RoleMenuMapper;
import com.kgc.community.pojo.Menu;
import com.kgc.community.pojo.MenuExample;
import com.kgc.community.pojo.RoleMenu;
import com.kgc.community.pojo.RoleMenuExample;
import com.kgc.community.service.MenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author Mr.Man
 * @Date 2020-11-26 14:11
 **/
@Service
public class MenuServiceImpl implements MenuService {

    @Resource
    MenuMapper menuMapper;
    @Resource
    RoleMenuMapper roleMenuMapper;

    /**
     * 查询用户的菜单
     * @param rid
     * @return
     */
    @Override
    public List<RoleMenu> selectByRid(Integer rid) {
        RoleMenuExample roleMenuExample = new RoleMenuExample();
        roleMenuExample.createCriteria().andRoleIdEqualTo(rid);
        List<RoleMenu> roleMenus = roleMenuMapper.selectByExample(roleMenuExample);
        return roleMenus;
    }

    public void test01(){
        List<RoleMenu> roleMenus = this.selectByRid(1);
    }
}
